Assignemnt #12 and Ninth Program
Code
/// Name: Derrick Andreasen
/// period: 7
/// Program name: ninth program
/// File name: NinProg.java
/// Date finished: 9/11/2015
public class NinProg
{
public static void main( String[] args )
{
int cars, drivers, passengers, cars_not_driven, cars_driven;
double space_in_a_car, carpool_capacity, average_passengers_per_car;
//= gives names to thing assigned to
cars = 100;
//changing 4.0 to 4 did nothing
space_in_a_car = 4;
drivers = 30;
passengers = 90;
cars_not_driven = cars - drivers;
cars_driven = drivers;
carpool_capacity = cars_driven * space_in_a_car;
average_passengers_per_car = passengers / cars_driven;
//+ cars + puts in the number from line thirteen
System.out.println( "There are " + cars + " cars available." );
// + drivers + puts in the number from line 16
System.out.println( "There are only " + drivers + " drivers available." );
// + cars_not_driven + puts in number from line puts in number from line 18
System.out.println( "There will be " + cars_not_driven + " empty cars today." );
// + carpool_capacity + puts in number from line 20
System.out.println( "We can transport " + carpool_capacity + " people today." );
// + passangers + puts in number from line 17
System.out.println( "We have " + passengers + " to carpool today." );
//+ average_passengers_per_car + puts in number from line 21
System.out.println( "We need to put about " + average_passengers_per_car + " in each car." );
}
}
Picture of the output